using System;

namespace Phoenix.Diagnostics
{
    public class DelegateListener : ITraceListener
    {
        private readonly Action<string> writeLine;

        public DelegateListener(Action<string> writeLine)
        {
            this.writeLine = writeLine;
        }

        public void Write(DateTime logTime, TraceLevel traceLevel, string category, Type sourceType, string traceMessage, string formattedMessage)
        {
            writeLine(formattedMessage);
        }
    }
}